package com.lecture.java8.gui;

import java.sql.Connection;
import java.sql.DriverManager;

public class getConnection {
    private static Connection conn=null;
    private static String address="jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true";

    private static String uname="root";

    private static String upwd="Lu!@#123";
    public static Connection getConnection(){
        try {
            conn=null;
            Class.forName("com.mysql.cj.jdbc.Driver");
            conn=DriverManager.getConnection(address,uname,upwd);
        }
        catch (Exception e) {
            e.printStackTrace();
        }
        return conn;//
    }
}
